<?php

if (!defined('ACCOUNT_INIT'))
	exit ('Access Denied!');

class core {

	private $db = null;

	public function __construct($db) {
		$this->db = $db;
		$this->ip = $_SERVER['REMOTE_ADDR'];
	}

	public function __destruct() {
		unset ($this->db);
	}

	public function session_login($uin,$sessionKey){
		if ($uin > 0 && $sessionKey != ""){
			$sql = "CALL ".DB_NAME_IM.".sp_cklogin('{$uin}','{$sessionKey}','session','{$this->ip}','service')";
			$result = $this->db->query($sql);
			if (is_object($result)) {
				$row_arr = $result->fetch_array();
				next_result($this->db);
				return $row_arr;
			}
		}
		return false;
	}
}
?>